import django_filters
from .models import Task


# 表格字段筛选
class TaskFilter(django_filters.FilterSet):
    name = django_filters.CharFilter(field_name='name', lookup_expr='contains')
    reporter = django_filters.CharFilter(field_name='reporter', lookup_expr='contains')
    startTime = django_filters.DateTimeFilter(field_name='time', lookup_expr='gte')
    endTime = django_filters.DateTimeFilter(field_name='time', lookup_expr='lte')

    class Meta:
        model = Task
        fields = ('name', 'reporter', 'startTime', 'endTime')
